<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>Test Pagination Extension with i18n override</title>
		<meta name="viewport" content="width=570">
		<style>
			@import "../../../dojo/resources/dojo.css";
			.heading {
				font-weight: bold;
				padding-bottom: 0.25em;
			}
			.dgrid {
				width: 750px;
				margin: 10px;
			}
		</style>
		<script src="../../../dojo/dojo.js" 
			data-dojo-config="async: true"></script>
		<script>
			// allow retrieving skin from GET param
			var skin = "claro",
				match = /\bskin=([^&]*)/.exec(location.search),
				skinDep, updateGrid,
				getColumns, getColumns2;
			if(match){ skin = match[1]; }
			skinDep = "xstyle/css!dgrid/css/skins/" + skin + ".css";
			
			require([skinDep, "dgrid/Grid", "dgrid/extensions/Pagination",
					"dojo/i18n!dgrid/extensions/nls/pagination", "dgrid/Selection", "dgrid/Keyboard",
					"dojo/_base/lang", "dojo/_base/declare", "dojo/dom-construct", "dojo/dom-form", "dgrid/test/data/base", "dojo/domReady!"],
				function(skinResource, Grid, Pagination, i18nPagination, Selection, Keyboard,
						lang, declare, domConstruct, domForm, testStore){
					
					// Create a custom Pagination class with a distinct i18n bundle
					// In this case, we're overriding just one value, so we're
					// loading the original one to serve as a basis
					var i18nCustomized = lang.mixin({}, i18nPagination, {
						status: "Total: ${total} - Showing from ${start} to ${end}"
					});
					var MyPagination = declare(Pagination, {
						i18nPagination: i18nCustomized
					});

					// Create our custom grid using MyPagination
					var CustomGrid = declare([Grid, Keyboard, Selection, MyPagination]);
					
					document.body.className = skin;
					
					window.grid = new CustomGrid({
						sort: "id",
						store: testAsyncStore,
						columns: {
							col1: 'Column 1',
							col2: {label: 'Column2', sortable: false},
							col3: 'Column 3',
							col4: 'Column 4',
							col5: 'Column 5'
						}
					}, "grid");
				});
		</script>
	</head>
	<body>
		<h2>A paginated grid with custom i18n</h2>
		<p>Assuming success, the status in the lower left should read "Total: 100 - Showing from 1 to 10"</p>
		<div id="grid"></div>
	</body>
</html>
